﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DataMappers;
using ExaminationTT.Model;

namespace ConcreteMappersAndObjects.DomainObjects
{
    public struct RoomExamKey
    {

        private int _roomKey, _examKey;
        public RoomExamKey(int roomKey, int examKey)
        {
            _roomKey = roomKey;
            _examKey = examKey;
        }
        public int RoomKey
        {
            get { return _roomKey; }
        }

        public int ExamKey
        {
            get { return _examKey; }
        }

         }
    public class RoomExam : DomainObject<RoomExamKey, RoomExam> , IRoomExam
    {
        protected override RoomExam Self()
        {
            return this;
        }

        private IValueHolder<int, Room> _room;
        private IValueHolder<int, Exam> _exam;

        public RoomExam() : base()
        {
            _room = new ConcreteValueHolder<int, Room>();
            _exam = new ConcreteValueHolder<int, Exam>();
        }

        public RoomExam(RoomExamKey ID, IValueHolder<int, Room> room, IValueHolder<int, Exam> exam) : base(ID)
        {
            _room = room;
            _exam = exam;
        }

        #region IRoomExams Members

        public Room Room
        {
            get { return _room.Get(); }
            set 
            {
                _room.Set(value);
            }
        }

        public Exam Exam
        {
            get { return _exam.Get(); }
            set { _exam.Set(value); }
        }

        #endregion

        #region IRoomExam Members

        IRoom IRoomExam.Room
        {
            get { return _room.Get(); }
        }

        IExam IRoomExam.Exam
        {
            get { return _exam.Get(); }
        }

        #endregion
    }
}
